package com.solcoo.dao;

import java.sql.SQLException;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.solcoo.pojo.Menu;
import com.solcoo.pojo.RechargeInfo;

@Repository
public class RechargeDao {

	@Resource
	private SqlMapClient sqlMapClient;
	
    private static final String SELECT_RECHARGE_INFO = "selectRechargeInfo";
    private static final String INSERT_RECHARGE_INFO = "insertRechargeInfo";
    private static final String DELETE_RECHARGE_INFO = "deleteRechargeInfo";


    /**
     * 查询活动信息
     */
    public List<RechargeInfo> selectRechargeInfo(String merchantId) throws SQLException {
        return sqlMapClient.queryForList(SELECT_RECHARGE_INFO,merchantId);
    }

    public void addRechargeInfo(RechargeInfo ri) throws SQLException {
        sqlMapClient.insert(INSERT_RECHARGE_INFO,ri);
    }

    public void deleteRechargeInfo(long rechargeInfoId) throws SQLException {
        sqlMapClient.delete(DELETE_RECHARGE_INFO,rechargeInfoId);
    }
    
    public RechargeInfo getRechargeInfo(Long id) throws SQLException {
		return (RechargeInfo) sqlMapClient.queryForObject("selectRechargeById", id);
	}
}
